const http = uni.$u.http
export default {
  /**
   * 政策配置
   */
    // TODO
    getPolicyList: (data) => http.get('/policy/list', data),
    getPolicyDetail: (data) => http.get('/policy/' + data.id),
    // TODO
    /**
     * 登录
     */
    getMemberInfo: (data) => http.get('/user/' + data.id),
    updateMemberInfo: (data) => http.put('/user/' + data.id, data),
    register: (data) => http.post('/user/register', data),
    login: (data) => http.post('/user/login', data),

  /**
   * 业务接口
   */
  getCityList: (data) => http.get('/city/tree'),
  // banner列表
  getWxBannerList: (data) => http.get('/banner/list', data),
  // 房屋列表
  getIdleItemPage: (data) => http.get('/idleItem', data),
  // 菜单树
  getCategoryTree: (data) => http.get('/idleCategory/tree', data),
  getResourceDetail: (data) =>  http.get('/idleItem/' + data.id),
  // 申请 idleTransfer/apply
  applyResource: (data) => http.post('/idleTransfer/apply', data),
  // 创建idleItem
  createIdleItem: (data) => http.post('/idleItem', data),
  getIdleItem: (data) => http.get('/idleItem/' + data.id),
  updateIdleItem: (data) => http.put('/idleItem/' + data.id, data),
  updateIdleItemStatus: data => http.post('/idleItem/status', data),

  // 我的申请
  getMyApply: data => http.get('/idleTransfer', data),
  getMyApplyDetail: data => http.get('/idleTransfer/' + data.id, data),
  cancelMyApplies: data => http.post(`/idleTransfer/cancel`, data),
  approveMyApplies: (data) => http.post(`/idleTransfer/approve`, data),

  // 我的收藏
  /**
   *
   *   router.post('/api/idleFavorite/toggle', controller.idleFavorite.toggle);
   *   router.get('/api/idleFavorite/myFavorites', controller.idleFavorite.myFavorites);
   *   router.get('/api/idleFavorite/check', controller.idleFavorite.check);
   */
  getMyFavorites: data => http.get('/idleFavorite/myFavorites', data),
  toggleMyFavorites: data => http.post('/idleFavorite/toggle', data),
  checkMyFavorites: data => http.get('/idleFavorite/check', data),
  
  // 数据统计
  getUserDeviceStats: data => http.get('/idleItem/userStats', data),
  getSystemDeviceStats: data => http.get('/idleItem/systemStats', data),
  getTransferStats: data => http.get('/idleTransfer/stats', data),
}
